#!/bin/bash

rm -rf "$HOME/Slam_log/sensor_data"/*

ros2 service call /slam_log_data slam_ros_msgs/srv/LogSlamData "{log_status: 1}"
sleep 1

LOG_TIME=$(date "+%Y%m%d_%H%M")

tar -czvf "$HOME/Slam_log/slam_log_${LOG_TIME}.tar.gz" \
    "$HOME/map" \
    "$HOME/Slam_log" \
    "$HOME/lgimRobot/share/slam_ros"

echo "SLAM日志已打包完成: $HOME/Slam_log/slam_log_${LOG_TIME}.tar.gz"